<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title th:text="${news?.title} + ' - 智慧农业信息管理系统'">新闻详情</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f5f7fa;
        }
        .navbar {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .news-detail {
            background: white;
            border-radius: 10px;
            padding: 40px;
            margin: 30px auto;
            max-width: 900px;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }
        .news-header {
            border-bottom: 2px solid #f0f0f0;
            padding-bottom: 20px;
            margin-bottom: 30px;
        }
        .news-title {
            font-size: 2rem;
            font-weight: 600;
            color: #333;
            margin-bottom: 15px;
        }
        .news-meta {
            color: #999;
            font-size: 0.95rem;
        }
        .news-content {
            font-size: 1.05rem;
            line-height: 1.8;
            color: #444;
            text-align: justify;
        }
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark">
        <div class="container-fluid">
            <a class="navbar-brand" href="/index">🌾 智慧农业管理系统</a>
            <div class="navbar-nav ms-auto">
                <a class="btn btn-outline-light btn-sm me-2" href="/news/index">返回列表</a>
                <a class="btn btn-outline-light btn-sm" href="/index">返回首页</a>
            </div>
        </div>
    </nav>

    <div class="news-detail" th:if="${news != null}">
        <div class="news-header">
            <h1 class="news-title" th:text="${news.title}">新闻标题</h1>
            <div class="news-meta">
                <span class="me-4">
                    <i class="far fa-user me-2"></i>
                    <span th:text="${news.author}">作者</span>
                </span>
                <span class="me-4">
                    <i class="far fa-clock me-2"></i>
                    <span th:text="${#temporals.format(news.publishTime, 'yyyy-MM-dd HH:mm')}">发布时间</span>
                </span>
                <span>
                    <i class="far fa-eye me-2"></i>
                    <span th:text="${news.viewCount}">0</span> 次浏览
                </span>
            </div>
        </div>
        
        <div class="news-content" th:utext="${#strings.replace(news.content, '&#10;', '<br/>')}">
            新闻正文内容
        </div>
    </div>
    
    <div th:if="${news == null}" class="alert alert-warning text-center mt-5">
        <i class="fas fa-exclamation-triangle me-2"></i>新闻不存在或已删除
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
</body>
</html>

